<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* p{
            width: 200px;
            height: 50px;
            border: 1px solid rebeccapurple;
            text-align: center;
            line-height: 50px;
        } */
        .container{
            width: 500px;
            height: 200px;
            border: 1px solid rebeccapurple;
            position: relative;
        }
        .wrapper{
            width: 100px;
            height: 100px;
            border: 1px solid red;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            /* margin-top: calc((200px - 100px)/2);
            margin-left: calc((200px - 100px)/2); */
        }
        /* 在不知道盒子宽高的情况下给父元素设置相对定位，给子元素设置绝对定位  */
    </style>
</head>
<body>
    <!-- <p>kW32的盛旺是人</p> -->

    <div class="container">
        <div class="wrapper">

        </div>
    </div>
</body>
</html>